const weatherService = require("../server/weather");
module.exports = class weatherController {
  static async getWeacher(ctx) {
    try {
      const { city } = ctx.request.query;
      let data = await weatherService.getWeather(city);
      ctx.body = {
        status: 200,
        data,
        msg: "获取天气成功！！",
      };
    } catch (err) {
      ctx.body = {
        status: 400,
        msg: "获取天气失败！！",
      };
    }
  }
};
